<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //转number : parseInt转为整数 
        console.log(parseInt("10"));
        console.log(parseInt("10asd")); 
        console.log(parseInt("g10")); //nan
        console.log(parseInt("1ss"));
        console.log(parseInt("10.98"));
        console.log(parseInt("10.98snss"));//10

        //parseFoat 转换为小数
        console.log(parseFloat("10"));
        console.log(parseFloat("10asd"));
        console.log(parseFloat("g10")); //nan
        console.log(parseFloat("1ss"));
        console.log(parseFloat("10.98"));
        console.log(parseFloat("10.98snss")); // 10.98

        //Number 转换为数字，但是比较严格
        console.log(Number("10"));
        console.log(Number("10asd"));//nan
        console.log(Number("g10"));//nan
        console.log(Number("1ss"));//nan
        console.log(Number("10.98"));
        console.log(Number("10.98snss"));//nan

        //转换为string toString 和 STRING()
        var num = 10 ;
        console.log(num.toString());
        console.log(String(num));
        var num2;
        console.log(String(num2));
        var num3 = null;
        console.log(String(num3));
        

    </script>
</body>

</html>